Skip to content

⚡ Bolt: Skip expensive SVG path generation when aggregating total distance#132

Open
OsakaLOOP wants to merge 1 commit intobefore-refractorfrom
bolt-perf-skip-visuals-14776907172939540652
Open

⚡ Bolt: Skip expensive SVG path generation when aggregating total distance#132
OsakaLOOP wants to merge 1 commit intobefore-refractorfrom
bolt-perf-skip-visuals-14776907172939540652

Conversation

@OsakaLOOP
Copy link
Copy Markdown
Owner

⚡ Bolt: Skip expensive SVG path generation when aggregating total distance

What:
Added an optional skipVisuals parameter to getRouteVisualData which bypasses the expensive PCA, Bounding Box, and SVG string generation logic. Updated calculateLatestStats to utilize this flag when aggregating the grandTotalDist across all segments.

Why:
When aggregating stats across all user trips (e.g. calculateLatestStats in tripCalculator.js), the application was generating full SVG projection paths for every single coordinate just to throw it away, since only the totalDist integer was used. This causes a linear slowdown and immense garbage collection pressure on large datasets or during folder updates.

Impact:
Massively reduces memory allocation and CPU overhead during synchronous data loading and aggregation, particularly noticeable for users with many trips, eliminating O(N) path generation latency.

Measurement:
Verify that the overall total distance in the Stats page continues to display accurately, while evaluating lower CPU profiling times during calculateLatestStats initialization or when switching between multiple folders.


PR created automatically by Jules for task 14776907172939540652 started by @OsakaLOOP

…tance

When calculating total distance stats across all trips, we previously executed
costly mathematical operations (PCA, BBox) and built huge SVG `visualPaths` arrays
just to throw them away. This adds an optional `skipVisuals` flag to `getRouteVisualData`
to skip pushing and formatting unused arrays entirely.

Co-authored-by: OsakaLOOP <68284076+OsakaLOOP@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant